<?php
include "../../public/common/config.php";
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../public/css/common.css"/>
	</head>
	<body>
		<div class="main">
			<form action="insert.php" method="post" enctype="multipart/form-data">
				<p>
					<label>商品名称：</label>
					<input type="text" name="name" />
				</p>
				<p>
					<label>价 格：</label>
					<input type="text" name="price" />
				</p>
				<p>
					<label>库 存：</label>
					<input type="text" name="stock" />
				</p>
				<p>
					<label>品 牌：</label>
					<select name="brand_id">
						<?php
							$sqlClass = "select * from class";
							$resClass = mysql_query($sqlClass);
							while($rowClass = mysql_fetch_assoc($resClass)){
								echo "<option disabled>{$rowClass['name']}</option>";
								$sqlBrand = "select * from brand where class_id = {$rowClass[id]}";
								$resBrand = mysql_query($sqlBrand);
								while($rowBrand = mysql_fetch_assoc($resBrand)){
									echo "<option value='{$rowBrand['id']}'>|--{$rowBrand['name']}</option>";
								}
							}						
						?>					
					</select>
				</p>
				<p>
					<label>货 架：</label></p>
				<p>
					<label>
						<input type="radio" name="shelf" value="1" checked="checked" />上架
					</label>
					<label>
						<input type="radio" name="shelf" value="0" />下架
					</label>
				</p>
				<p>
					<label>图 片：</label>
					<input type="file" name="img" />
				</p>
				<p><input type="submit" value="添加"/></p>
			</form>
		</div>
	</body>
	
</html>